package com.newlink.building.userinfo.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.newlink.building.common_base.model.bean.FlsMessageData
import com.newlink.building.common_base.utils.TimezoneConvert
import com.newlink.building.userinfo.R

/**
 * @author wangyang
 * @date 2022/9/19
 * @description 我的——消息中心页面的Adapter
 */
class Module_UserInfo_FlsMessageAdapter(data: MutableList<FlsMessageData>) :
    BaseQuickAdapter<FlsMessageData, BaseViewHolder>(R.layout.item_message_center, data),
    LoadMoreModule {

    override fun convert(holder: BaseViewHolder, item: FlsMessageData) {
        holder.setText(R.id.tv_title, item.title)
        holder.setText(R.id.tv_date, TimezoneConvert.formatTimestamp(item.createTimeUnix, true))
        holder.setText(R.id.tv_describe, item.message)
        if (item.readFlag == 1) {
            //已读
            holder.setGone(R.id.iv_unread, true)
        } else {
            //未读
            holder.setGone(R.id.iv_unread, false)
        }
    }
}